//
//  Brand.swift
//
//  Created by zwb on 2018/5/18
//  Copyright (c) aowang. All rights reserved.
//

import Foundation
import ObjectMapper

public final class ZyaFeedOrder: Mappable {

  // MARK: Declaration for string constants to be used to decode and also serialize.
  private struct SerializationKeys {
    static let brandUnit = "brand_unit"
    static let brandSpec = "brand_spec"
    static let brandId = "brand_id"
    static let brandSortId = "brand_sort_id"
    static let brandStand = "brand_stand"
    static let vouId = "vou_id"
    static let brandNm = "brand_nm"
    static let orgCode = "org_code"
    static let orgName = "org_name"
    static let staffId = "staff_id"
    static let staffNm = "staff_nm"
    static let brandPrice = "brand_price"
    static let clientNm = "client_nm"
    static let brandAddress = "brand_address"
    static let basCatenaNm = "bas_catena_nm"
    static let cbTypeNm = "cb_type_nm"
    static let basSortCode = "bas_sort_code"
    static let amount = "amount"
  }

  // MARK: Properties
  public var brandUnit: String?
  public var brandSpec: String?
  public var brandId: String?
  public var brandSortId: String?
  public var brandStand: String?
  public var vouId: String?
  public var brandNm: String?
  public var orgCode: String?
  public var orgName: String?
  public var staffId: String?
  public var staffNm: String?
  public var brandPrice: String?
  public var clientNm: String?
  public var brandAddress: String?
  public var basCatenaNm: String?
  public var cbTypeNm: String?
  public var amount = ""
  public var isSelected = false
  public var basSortCode: String?
  public var idKey = ""

  // MARK: ObjectMapper Initializers
  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public required init?(map: Map){

  }

  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public func mapping(map: Map) {
    brandUnit <- map[SerializationKeys.brandUnit]
    brandSpec <- map[SerializationKeys.brandSpec]
    brandId <- map[SerializationKeys.brandId]
    brandSortId <- map[SerializationKeys.brandSortId]
    brandStand <- map[SerializationKeys.brandStand]
    vouId <- map[SerializationKeys.vouId]
    brandNm <- map[SerializationKeys.brandNm]
    orgCode <- map[SerializationKeys.orgCode]
    orgName <- map[SerializationKeys.orgName]
    staffId <- map[SerializationKeys.staffId]
    staffNm <- map[SerializationKeys.staffNm]
    brandPrice <- (map[SerializationKeys.brandPrice],StringTransform_test())
    clientNm <- map[SerializationKeys.clientNm]
    brandAddress <- map[SerializationKeys.brandAddress]
    basCatenaNm <- map[SerializationKeys.basCatenaNm]
    cbTypeNm <- map[SerializationKeys.cbTypeNm]
    basSortCode <- map[SerializationKeys.basSortCode]
    amount <- map[SerializationKeys.amount]
  }

  /// Generates description of the object in the form of a NSDictionary.
  ///
  /// - returns: A Key value pair containing all valid values in the object.
  public func dictionaryRepresentation() -> [String: Any] {
    var dictionary: [String: Any] = [:]
    if let value = brandUnit { dictionary[SerializationKeys.brandUnit] = value }
    if let value = brandSpec { dictionary[SerializationKeys.brandSpec] = value }
    if let value = brandId { dictionary[SerializationKeys.brandId] = value }
    if let value = brandSortId { dictionary[SerializationKeys.brandSortId] = value }
    if let value = brandStand { dictionary[SerializationKeys.brandStand] = value }
    if let value = vouId { dictionary[SerializationKeys.vouId] = value }
    if let value = brandNm { dictionary[SerializationKeys.brandNm] = value }
    if let value = orgCode { dictionary[SerializationKeys.orgCode] = value }
    if let value = orgName { dictionary[SerializationKeys.orgName] = value }
    if let value = staffId { dictionary[SerializationKeys.staffId] = value }
    if let value = staffNm { dictionary[SerializationKeys.staffNm] = value }
    if let value = brandPrice { dictionary[SerializationKeys.brandPrice] = value }
    if let value = clientNm { dictionary[SerializationKeys.clientNm] = value }
    if let value = brandAddress { dictionary[SerializationKeys.brandAddress] = value }
    if let value = basCatenaNm { dictionary[SerializationKeys.basCatenaNm] = value }
    if let value = cbTypeNm { dictionary[SerializationKeys.cbTypeNm] = value }
    if let value = basSortCode { dictionary[SerializationKeys.basSortCode] = value }

    return dictionary
  }

}
